package com.wing.purchase.dao;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wing.purchase.model.entity.PurchaseStorageWork;
import com.wing.purchase.model.response.PurchaseDetailExportVO;
import com.wing.purchase.model.response.PurchaseDetailStaticExportVO;
import com.wing.purchase.model.response.PurchaseProductInfoVO;
import com.wing.purchase.model.response.PurchaseStorageWorkVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 采购入库作业-Dao
 *
 * @author
 */
@Mapper
public interface PurchaseStorageWorkDao extends BaseMapper<PurchaseStorageWork> {

    /**
     * 列表-app
     *
     * @param params
     *
     * @return
     */
    List<PurchaseStorageWorkVO> list4app(@Param("params") Map<String, Object> params);

    /**
     * 分页列表-app
     *
     * @param page
     * @param params
     *
     * @return
     */
    List<PurchaseStorageWorkVO> list4app(@Param("page") Page<PurchaseStorageWorkVO> page, @Param("params") Map<String, Object> params);

    /**
     * 详情-app
     *
     * @param id
     *
     * @return
     */
    PurchaseStorageWorkVO get4appById(Long id);

    /**
     * 查询采购入库计划的产品是否全部入库
     * @param planId
     */
    boolean isAllInWarehousing(Long planId);

    /**
     * 校验签收数是否大于剩余入库数
     * @param purchaseSignForProductId
     * @return
     */
    BigDecimal getSurplusStorageNum(Long purchaseSignForProductId);

    /**
     * 获取已经签收数
     * @param purchaseSignForProductId
     * @return
     */
    BigDecimal getSignForNum(@Param("purchaseSignForId") Long purchaseSignForProductId);


    /**
     *  查询入库明细
     * @param page
     * @param params
     * @return
     */
    List<PurchaseProductInfoVO> getInProductInfoDetail(@Param("page") Page<PurchaseProductInfoVO> page, @Param("params") Map<String, Object> params);

    /**
     * 统计物料 每一天  每个仓库 的入库数量
     * @param params
     * @return
     */
    List<PurchaseProductInfoVO> getInProductInfoDetailStatic(@Param("page") Page<PurchaseProductInfoVO> page,@Param("params") Map<String, Object> params);

    /**
     * 导出统计物料
     * @param params
     * @return
     */
    List<PurchaseDetailStaticExportVO> toInProductInfoDetailStaticExport(@Param("params") Map<String, Object> params);

    /**
     * 导出入库明细
     * @param params
     * @return
     */
    List<PurchaseDetailExportVO> exportInProductInfoDetail(@Param("params") Map<String, Object> params);

}
